home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / latex209 / contrib / harvard / kluwer.bst < prev    next >
Text File  |  1994-06-16  |  25KB  |  1,339 lines

  1. % BibTeX standard bibliography style `kluwer' (one of the harvard family)
  2.     % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09.
  3.     % Copyright (C) 1991, all rights reserved.
  4.     % Copying of this file is authorized only if either
  5.     % (1) you make absolutely no changes to your copy, including name, or
  6.     % (2) if you do make changes, you name it something other than
  7.     % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, abbrv.bst, agsm.bst,
  8.         % dcu.bst or kluwer.bst.
  9.     % This restriction helps ensure that all standard styles are identical.
  10.     % The file harvard.tex has the documentation for this style.
  11.  
  12. % ACKNOWLEDGEMENT:
  13. %   This document is a modified version of alpha.bst to which it owes much of
  14. %   its functionality.
  15.  
  16. % AUTHOR
  17. %   Peter Williams, Key Centre for Design Quality, Sydney University
  18. %   e-mail: peterw@archsci.arch.su.oz.au
  19.  
  20. ENTRY
  21.   { address
  22.     author
  23.     booktitle
  24.     chapter
  25.     edition
  26.     editor
  27.     howpublished
  28.     institution
  29.     journal
  30.     key
  31.     month
  32.     note
  33.     number
  34.     organization
  35.     pages
  36.     publisher
  37.     school
  38.     series
  39.     title
  40.     type
  41.     volume
  42.     year
  43.   }
  44.   { field.used etal.allowed etal.required }
  45.   { extra.label sort.label list.year }
  46.  
  47. INTEGERS { output.state before.all mid.sentence after.sentence after.block }
  48.  
  49. FUNCTION {init.state.consts}
  50. { #0 'before.all :=
  51.   #1 'mid.sentence :=
  52.   #2 'after.sentence :=
  53.   #3 'after.block :=
  54. }
  55.  
  56. STRINGS { s t f }
  57.  
  58. FUNCTION {output.nonnull}
  59. { 's :=
  60.   output.state mid.sentence =
  61.     { ", " * write$ }
  62.     { output.state after.block =
  63.     { add.period$ write$
  64.       newline$
  65.       "\newblock " write$
  66.     }
  67.     { output.state before.all =
  68.         'write$
  69.         { add.period$ " " * write$ }
  70.       if$
  71.     }
  72.       if$
  73.       mid.sentence 'output.state :=
  74.     }
  75.   if$
  76.   s
  77. }
  78.  
  79. FUNCTION {output}
  80. { duplicate$ empty$
  81.     'pop$
  82.     'output.nonnull
  83.   if$
  84. }
  85.  
  86. FUNCTION {output.check}
  87. { 't :=
  88.   duplicate$ empty$
  89.     { pop$ "empty " t * " in " * cite$ * warning$ }
  90.     'output.nonnull
  91.   if$
  92. }
  93.  
  94. FUNCTION {item.check}
  95. { 't :=
  96.   empty$
  97.     { "empty " t * " in " * cite$ * warning$ }
  98.     { skip$ }
  99.   if$
  100. }
  101.  
  102. FUNCTION {fin.entry}
  103. { add.period$
  104.   write$
  105.   newline$
  106. }
  107.  
  108. FUNCTION {new.block}
  109. { output.state before.all =
  110.     'skip$
  111.     { after.block 'output.state := }
  112.   if$
  113. }
  114.  
  115. FUNCTION {not}
  116. {   { #0 }
  117.     { #1 }
  118.   if$
  119. }
  120.  
  121. FUNCTION {and}
  122. {   'skip$
  123.     { pop$ #0 }
  124.   if$
  125. }
  126.  
  127. FUNCTION {or}
  128. {   { pop$ #1 }
  129.     'skip$
  130.   if$
  131. }
  132.  
  133. FUNCTION {field.or.null}
  134. { duplicate$ empty$
  135.     { pop$ "" }
  136.     'skip$
  137.   if$
  138. }
  139.  
  140. FUNCTION {emphasize}
  141. { duplicate$ empty$
  142.     { pop$ "" }
  143.     { "{\em " swap$ * "}" * }
  144.   if$
  145. }
  146.  
  147. FUNCTION {embolden}
  148. { duplicate$ empty$
  149.     { pop$ "" }
  150.     { "{\bf " swap$ * "}" * }
  151.   if$
  152. }
  153.  
  154. FUNCTION {quote}
  155. { duplicate$ empty$
  156.     { pop$ "" }
  157.     { "`" swap$ * "'" * }
  158.   if$
  159. }
  160.  
  161. INTEGERS { nameptr namesleft numnames }
  162.  
  163. FUNCTION {format.names}
  164. { 's :=
  165.   'f :=
  166.   #1 'nameptr :=
  167.   s num.names$ 'numnames :=
  168.   numnames 'namesleft :=
  169.     { namesleft #0 > }
  170.     { s nameptr f format.name$ 't :=
  171.       nameptr #1 >
  172.     { namesleft #1 >
  173.         { ", " * t * }
  174.         { t "others" =
  175.         { " et~al." * }
  176.         { " and " * t * }
  177.           if$
  178.         }
  179.       if$
  180.     }
  181.     't
  182.       if$
  183.       nameptr #1 + 'nameptr :=
  184.       namesleft #1 - 'namesleft :=
  185.     }
  186.   while$
  187. }
  188.  
  189. FUNCTION {format.authors}
  190. { author empty$
  191.     { "" }
  192.     { "{vv~}{ll}{, jj}{, f.}" author format.names }
  193.   if$
  194. }
  195.  
  196. FUNCTION {format.editors}
  197. { editor empty$
  198.     { "" }
  199.     { "{vv~}{ll}{, jj}{, f.}" editor format.names
  200.       editor num.names$ #1 >
  201.     { " (eds)" * }
  202.     { " (ed.)" * }
  203.       if$
  204.     }
  205.   if$
  206. }
  207.  
  208. FUNCTION {format.editors.reverse}
  209. { editor empty$
  210.     { "" }
  211.     { "{f.~}{vv~}{ll}{, jj}" editor format.names
  212.       editor num.names$ #1 >
  213.     { " (eds)" * }
  214.     { " (ed.)" * }
  215.       if$
  216.     }
  217.   if$
  218. }
  219.  
  220. FUNCTION {format.title}
  221. { title empty$
  222.     { "" }
  223.     { title "t" change.case$ }
  224.   if$
  225. }
  226.  
  227. FUNCTION {n.dashify}
  228. { 't :=
  229.   ""
  230.     { t empty$ not }
  231.     { t #1 #1 substring$ "-" =
  232.     { t #1 #2 substring$ "--" = not
  233.         { "--" *
  234.           t #2 global.max$ substring$ 't :=
  235.         }
  236.         {   { t #1 #1 substring$ "-" = }
  237.         { "-" *
  238.           t #2 global.max$ substring$ 't :=
  239.         }
  240.           while$
  241.         }
  242.       if$
  243.     }
  244.     { t #1 #1 substring$ *
  245.       t #2 global.max$ substring$ 't :=
  246.     }
  247.       if$
  248.     }
  249.   while$
  250. }
  251.  
  252. FUNCTION {format.btitle}
  253. { title emphasize
  254. }
  255.  
  256. FUNCTION {tie.or.space.connect}
  257. { duplicate$ text.length$ #3 <
  258.     { "~" }
  259.     { " " }
  260.   if$
  261.   swap$ * *
  262. }
  263.  
  264. FUNCTION {either.or.check}
  265. { empty$
  266.     'pop$
  267.     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  268.   if$
  269. }
  270.  
  271. FUNCTION {format.bvolume}
  272. { volume empty$
  273.     { "" }
  274.     { "Vol." volume tie.or.space.connect
  275.       series empty$
  276.     'skip$
  277.     { " of " * series emphasize * }
  278.       if$
  279.       "volume and number" number either.or.check
  280.     }
  281.   if$
  282. }
  283.  
  284. FUNCTION {format.number.series}
  285. { volume empty$
  286.     { number empty$
  287.     { series field.or.null }
  288.     { output.state mid.sentence =
  289.         { "number" }
  290.         { "Number" }
  291.       if$
  292.       number tie.or.space.connect
  293.       series empty$
  294.         { "there's a number but no series in " cite$ * warning$ }
  295.         { " in " * series emphasize * }
  296.       if$
  297.     }
  298.       if$
  299.     }
  300.     { "" }
  301.   if$
  302. }
  303.  
  304. FUNCTION {format.edition}
  305. { edition empty$
  306.     { "" }
  307.     { output.state mid.sentence =
  308.     { edition "l" change.case$ " edn" * }
  309.     { edition "t" change.case$ " edn" * }
  310.       if$
  311.     }
  312.   if$
  313. }
  314.  
  315. INTEGERS { multiresult }
  316.  
  317. FUNCTION {multi.page.check}
  318. { 't :=
  319.   #0 'multiresult :=
  320.     { multiresult not
  321.       t empty$ not
  322.       and
  323.     }
  324.     { t #1 #1 substring$
  325.       duplicate$ "-" =
  326.       swap$ duplicate$ "," =
  327.       swap$ "+" =
  328.       or or
  329.     { #1 'multiresult := }
  330.     { t #2 global.max$ substring$ 't := }
  331.       if$
  332.     }
  333.   while$
  334.   multiresult
  335. }
  336.  
  337. FUNCTION {format.pages}
  338. { pages empty$
  339.     { "" }
  340.     { pages multi.page.check
  341.     { "pp.~" pages n.dashify * }
  342.     { "p.~" pages * }
  343.       if$
  344.     }
  345.   if$
  346. }
  347.  
  348. FUNCTION {format.vol.num.pages}
  349. { volume embolden field.or.null
  350.   number empty$
  351.     'skip$
  352.     { "(" number * ")" * *
  353.       volume empty$
  354.     { "there's a number but no volume in " cite$ * warning$ }
  355.     'skip$
  356.       if$
  357.     }
  358.   if$
  359.   pages empty$
  360.     'skip$
  361.     { duplicate$ empty$
  362.     { pop$ format.pages }
  363.     { ",~" * pages n.dashify * }
  364.       if$
  365.     }
  366.   if$
  367. }
  368.  
  369. FUNCTION {format.chapter.pages}
  370. { chapter empty$
  371.     'format.pages
  372.     { type empty$
  373.     { "chapter" }
  374.     { type "l" change.case$ }
  375.       if$
  376.       chapter tie.or.space.connect
  377.       pages empty$
  378.     'skip$
  379.     { ", " * format.pages * }
  380.       if$
  381.     }
  382.   if$
  383. }
  384.  
  385. FUNCTION {format.in.ed.booktitle}
  386. { booktitle empty$
  387.     { "" }
  388.     { editor empty$
  389.     { booktitle emphasize }
  390.     { "{\em in} " format.editors.reverse * ", " * booktitle emphasize * }
  391.       if$
  392.     }
  393.   if$
  394. }
  395.  
  396. FUNCTION {empty.misc.check}
  397. { author empty$ title empty$ howpublished empty$
  398.   month empty$ year empty$ note empty$
  399.   and and and and and
  400.   key empty$ not and
  401.     { "all relevant fields are empty in " cite$ * warning$ }
  402.     'skip$
  403.   if$
  404. }
  405.  
  406. FUNCTION {format.thesis.type}
  407. { type empty$
  408.     'skip$
  409.     { pop$
  410.       type "t" change.case$
  411.     }
  412.   if$
  413. }
  414.  
  415. FUNCTION {format.tr.number}
  416. { type empty$
  417.     { "Technical Report" }
  418.     'type
  419.   if$
  420.   number empty$
  421.     { "t" change.case$ }
  422.     { number tie.or.space.connect }
  423.   if$
  424. }
  425.  
  426. FUNCTION {format.article.crossref}
  427. { key empty$
  428.     { journal empty$
  429.     { "need key or journal for " cite$ * " to crossref " * crossref *
  430.       warning$
  431.       ""
  432.     }
  433.     { "in {\em " journal * "\/}" * " \cite{" * crossref * "}" *
  434.         }
  435.       if$
  436.     }
  437.     { " {\em in} \citeasnoun{" crossref * "}" * }
  438.   if$
  439. }
  440.  
  441. FUNCTION {format.book.crossref}
  442. { volume empty$
  443.     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  444.       "in "
  445.     }
  446.     { "Vol." volume tie.or.space.connect
  447.       " of " *
  448.     }
  449.   if$
  450.   editor empty$
  451.   editor field.or.null author field.or.null =
  452.   or
  453.     { key empty$
  454.     { series empty$
  455.         { "need editor, key, or series for " cite$ * " to crossref " *
  456.           crossref * warning$
  457.           "" *
  458.         }
  459.         { "{\em " * series * "\/}" * " \cite{" * crossref * "}" *}
  460.       if$
  461.     }
  462.     { " \citeasnoun{" * crossref * "}" * }
  463.       if$
  464.     }
  465.     { " \citeasnoun{" * crossref * "}" * }
  466.   if$
  467. }
  468.  
  469. FUNCTION {format.incoll.inproc.crossref}
  470. { editor empty$
  471.   editor field.or.null author field.or.null =
  472.   or
  473.     {
  474.       key empty$
  475.     { booktitle empty$
  476.         { "need editor, key, or booktitle for " cite$ * " to crossref " *
  477.           crossref * warning$
  478.           ""
  479.         }
  480.         { "in {\em " booktitle * "\/}" * " \cite{" * crossref * "}" *}
  481.       if$
  482.     }
  483.     { " {\em in} \citeasnoun{" crossref * "}" * }
  484.       if$
  485.     }
  486.     {  " {\em in} \citeasnoun{" crossref * "}" * }
  487.   if$
  488.  
  489. }
  490.  
  491. INTEGERS { len }
  492.  
  493. FUNCTION {chop.word}
  494. { 's :=
  495.   'len :=
  496.   s #1 len substring$ =
  497.     { s len #1 + global.max$ substring$ }
  498.     's
  499.   if$
  500. }
  501.  
  502. INTEGERS { ind tsslen }
  503.  
  504. STRINGS { tss ret rss istr }
  505.  
  506. FUNCTION {replace.substring}{
  507.   'rss :=
  508.   'tss :=
  509.   'istr :=
  510.   "" 'ret :=
  511.   tss text.length$ 'tsslen :=
  512.   #1 'ind :=
  513.     { istr ind tsslen substring$ "" = not }
  514.     { istr ind tsslen substring$ tss =
  515.         { ret rss * 'ret :=
  516.           ind tsslen + 'ind :=
  517.         }
  518.         { ret istr ind #1 substring$ * 'ret :=
  519.           ind #1 + 'ind :=
  520.         }
  521.       if$
  522.     }
  523.   while$
  524.   ret
  525. }
  526.  
  527. FUNCTION {format.lab.names.abbr}
  528. { 's :=
  529.   s num.names$ 'numnames :=
  530.   numnames #1 >
  531.     { numnames #2 >
  532.     { s #1 "{vv~}{ll}" format.name$ " et~al." * }
  533.     { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  534.             { s #1 "{vv~}{ll}" format.name$ " et~al." * }
  535.         { s #1 "{vv~}{ll}" format.name$ " and " *
  536.               s #2 "{vv~}{ll}" format.name$ * 
  537.             }
  538.           if$
  539.         }
  540.       if$
  541.     }
  542.     { s #1 "{vv~}{ll}" format.name$ }
  543.   if$
  544. }
  545.  
  546. FUNCTION {format.lab.names.full}
  547. { 's :=
  548.   #1 'nameptr :=
  549.   s num.names$ 'numnames :=
  550.   numnames 'namesleft :=
  551.     { namesleft #0 > }
  552.     { s nameptr "{vv~}{ll}" format.name$ 't :=
  553.       nameptr #1 >
  554.     { namesleft #1 >
  555.         { ", " * t * }
  556.         { t "others" =
  557.         { " et~al." * }
  558.         { " and " * t * }
  559.           if$
  560.         }
  561.       if$
  562.     }
  563.     't
  564.       if$
  565.       nameptr #1 + 'nameptr :=
  566.       namesleft #1 - 'namesleft :=
  567.     }
  568.   while$
  569. }
  570.  
  571. INTEGERS { author.field editor.field organization.field title.field key.field }
  572.  
  573. FUNCTION {init.field.constants}
  574. { #0 'author.field :=
  575.   #1 'editor.field :=
  576.   #2 'organization.field :=
  577.   #3 'title.field :=
  578.   #4 'key.field :=
  579. }
  580.  
  581. FUNCTION {make.list.label}
  582. { author.field field.used =
  583.     { format.authors }
  584.     { editor.field field.used =
  585.         { format.editors }
  586.         { organization.field field.used =
  587.             { "The " #4 organization chop.word #3 text.prefix$ }
  588.             { title.field field.used =
  589.                 { format.btitle }
  590.                 { key.field field.used =
  591.                     { key #3 text.prefix$ }
  592.                     { "Internal error :001 on " cite$ * " label" * warning$ }
  593.                   if$
  594.                 }
  595.               if$
  596.             }
  597.           if$
  598.         }
  599.       if$
  600.     }
  601.   if$
  602. }
  603.  
  604. FUNCTION {make.full.label}
  605. { author.field field.used =
  606.     { author format.lab.names.full }
  607.     { editor.field field.used =
  608.         { editor format.lab.names.full }
  609.         { organization.field field.used =
  610.             { "The " #4 organization chop.word #3 text.prefix$ }
  611.             { title.field field.used =
  612.                 { format.btitle }
  613.                 { key.field field.used =
  614.                     { key #3 text.prefix$ }
  615.                     { "Internal error :001 on " cite$ * " label" * warning$ }
  616.                   if$
  617.                 }
  618.               if$
  619.             }
  620.           if$
  621.         }
  622.       if$
  623.     }
  624.   if$
  625. }
  626.  
  627. FUNCTION {make.abbr.label}
  628. { etal.allowed
  629.     { author.field field.used =
  630.         { author format.lab.names.abbr }
  631.         { editor.field field.used =
  632.             { editor format.lab.names.abbr }
  633.             { organization.field field.used =
  634.                 { "The " #4 organization chop.word #3 text.prefix$ }
  635.                 { title.field field.used =
  636.                     { format.btitle }
  637.                     { key.field field.used =
  638.                         { key #3 text.prefix$ }
  639.                         {"Internal error :001 on " cite$ * " label" * warning$ }
  640.                       if$
  641.                     }
  642.                   if$
  643.                 }
  644.               if$
  645.             }
  646.           if$
  647.         }
  648.       if$
  649.     }
  650.     { make.full.label }
  651.   if$
  652. }
  653.  
  654. FUNCTION {output.bibitem}
  655. { newline$
  656.   etal.allowed        %%%XXX change
  657.   etal.required
  658.   and
  659.     {
  660.       "\harvarditem[" write$
  661.       make.abbr.label write$
  662.       "]{" write$
  663.     }
  664.     {
  665.       "\harvarditem{" write$
  666.     }
  667.   if$
  668.   make.full.label write$
  669.   "}{" write$
  670.   list.year write$
  671.   "}{" write$
  672.   cite$ write$
  673.   "}" write$
  674.   newline$
  675.   ""
  676.   before.all 'output.state :=
  677. }
  678.  
  679.  
  680. FUNCTION {list.label.output}
  681. { make.list.label write$
  682. }
  683.  
  684. FUNCTION {article}
  685. { output.bibitem
  686.   list.label.output
  687.   ": " list.year * output.nonnull
  688.   author "author" item.check
  689.   title.field field.used =
  690.     { skip$ }
  691.     { format.title "title" output.check }
  692.   if$
  693.   crossref missing$
  694.     { journal emphasize "journal" duplicate$ item.check
  695.       pages empty$
  696.         {
  697.           output
  698.         }
  699.         {
  700.           " " *
  701.           format.vol.num.pages * output
  702.         }
  703.       if$
  704.     }
  705.     { format.article.crossref output.nonnull
  706.       format.pages output
  707.     }
  708.   if$
  709.   new.block
  710.   note output
  711.   fin.entry
  712. }
  713.  
  714. FUNCTION {book}
  715. { output.bibitem
  716.   list.label.output
  717.   ": " list.year * output.nonnull
  718.   author empty$
  719.     { editor "author and editor" item.check }
  720.     { crossref missing$
  721.     { "author and editor" editor either.or.check }
  722.     'skip$
  723.       if$
  724.     }
  725.   if$
  726.   title.field field.used =
  727.     { skip$ }
  728.     { format.btitle "title" output.check }
  729.   if$
  730.   crossref missing$
  731.     { format.bvolume output
  732.       format.number.series output
  733.       format.edition output
  734.       publisher "publisher" output.check
  735.       address output
  736.     }
  737.     { format.book.crossref output.nonnull
  738.       format.edition output
  739.     }
  740.   if$
  741.   new.block
  742.   note output
  743.   fin.entry
  744. }
  745.  
  746. FUNCTION {booklet}
  747. { output.bibitem
  748.   list.label.output
  749.   ": " list.year * output.nonnull
  750.   title.field field.used =
  751.     { skip$ }
  752.     { format.title "title" output.check }
  753.   if$
  754.   howpublished output
  755.   address output
  756.   new.block
  757.   note output
  758.   fin.entry
  759. }
  760.  
  761. FUNCTION {inbook}
  762. { output.bibitem
  763.   list.label.output
  764.   ": " list.year * output.nonnull
  765.   author empty$
  766.     { editor "author and editor" item.check }
  767.     { crossref missing$
  768.     { "author and editor" editor either.or.check }
  769.     'skip$
  770.       if$
  771.     }
  772.   if$
  773.   title.field field.used =
  774.     { skip$ }
  775.     { format.btitle "title" output.check }
  776.   if$
  777.   crossref missing$
  778.     { format.bvolume output
  779.       format.number.series output
  780.       format.edition output
  781.       publisher "publisher" output.check
  782.       address output
  783.     }
  784.     { format.book.crossref output.nonnull
  785.       format.edition output
  786.     }
  787.   if$
  788.   format.chapter.pages "chapter and pages" output.check
  789.   new.block
  790.   note output
  791.   fin.entry
  792. }
  793.  
  794. FUNCTION {incollection}
  795. { output.bibitem
  796.   list.label.output
  797.   ": " list.year * output.nonnull
  798.   title.field field.used =
  799.     { skip$ }
  800.     { format.title "title" output.check }
  801.   if$
  802.   author "author" item.check
  803.   crossref missing$
  804.     { format.in.ed.booktitle "booktitle" output.check
  805.       format.edition output
  806.       format.bvolume output
  807.       format.number.series output
  808.       publisher "publisher" output.check
  809.       address output
  810.     }
  811.     { format.incoll.inproc.crossref output.nonnull
  812.     }
  813.   if$
  814.   format.chapter.pages output
  815.   new.block
  816.   note output
  817.   fin.entry
  818. }
  819.  
  820. FUNCTION {inproceedings}
  821. { output.bibitem
  822.   list.label.output
  823.   ": " list.year * output.nonnull
  824.   title.field field.used =
  825.     { skip$ }
  826.     { format.title "title" output.check }
  827.   if$
  828.   author "author" item.check
  829.   crossref missing$
  830.     { format.in.ed.booktitle "booktitle" output.check
  831.       format.bvolume output
  832.       format.number.series output
  833.       address empty$
  834.     { organization output
  835.       publisher output
  836.     }
  837.     { organization output
  838.       publisher output
  839.       address output.nonnull
  840.     }
  841.       if$
  842.     }
  843.     { format.incoll.inproc.crossref output.nonnull
  844.     }
  845.   if$
  846.   format.pages output
  847.   new.block
  848.   note output
  849.   fin.entry
  850. }
  851.  
  852. FUNCTION {conference} { inproceedings }
  853.  
  854. FUNCTION {manual}
  855. { output.bibitem
  856.   list.label.output
  857.   ": " list.year * output.nonnull
  858.   title.field field.used =
  859.     { skip$ }
  860.     { format.btitle "title" output.check }
  861.   if$
  862.   format.edition output
  863.   author empty$
  864.     { organization empty$
  865.     { address output
  866.     }
  867.     'skip$
  868.       if$
  869.     }
  870.     { organization output
  871.       address output
  872.     }
  873.   if$
  874.   new.block
  875.   note output
  876.   fin.entry
  877. }
  878.  
  879. FUNCTION {mastersthesis}
  880. { output.bibitem
  881.   list.label.output
  882.   ": " list.year * output.nonnull
  883.   author "author" item.check
  884.   title.field field.used =
  885.     { skip$ }
  886.     { format.title emphasize "title" output.check }
  887.   if$
  888.   "Master's thesis" format.thesis.type output.nonnull
  889.   school "school" output.check
  890.   address output
  891.   new.block
  892.   note output
  893.   fin.entry
  894. }
  895.  
  896. FUNCTION {misc}
  897. { output.bibitem
  898.   list.label.output
  899.   ": " list.year * output.nonnull
  900.   title.field field.used =
  901.     { skip$ }
  902.     { format.title output }
  903.   if$
  904.   howpublished output
  905.   new.block
  906.   note output
  907.   fin.entry
  908.   empty.misc.check
  909. }
  910.  
  911. FUNCTION {phdthesis}
  912. { output.bibitem
  913.   list.label.output
  914.   ": " list.year * output.nonnull
  915.   author "author" item.check
  916.   title.field field.used =
  917.     { skip$ }
  918.     { format.btitle "title" output.check }
  919.   if$
  920.   "PhD thesis" format.thesis.type output.nonnull
  921.   school "school" output.check
  922.   address output
  923.   new.block
  924.   note output
  925.   fin.entry
  926. }
  927.  
  928. FUNCTION {proceedings}
  929. { output.bibitem
  930.   list.label.output
  931.   ": " list.year * output.nonnull
  932.   title.field field.used =
  933.     { skip$ }
  934.     { format.btitle "title" output.check }
  935.   if$
  936.   format.bvolume output
  937.   format.number.series output
  938.   address empty$
  939.     { editor empty$
  940.     { skip$ }
  941.     { organization output
  942.     }
  943.       if$
  944.       publisher output
  945.     }
  946.     { editor empty$
  947.     'skip$
  948.     { organization output }
  949.       if$
  950.       publisher output
  951.       address output.nonnull
  952.     }
  953.   if$
  954.   new.block
  955.   note output
  956.   fin.entry
  957. }
  958.  
  959. FUNCTION {techreport}
  960. { output.bibitem
  961.   list.label.output
  962.   ": " list.year * output.nonnull
  963.   author "author" item.check
  964.   title.field field.used =
  965.     { skip$ }
  966.     { format.title "title" output.check }
  967.   if$
  968.   format.tr.number emphasize output.nonnull
  969.   institution "institution" output.check
  970.   address output
  971.   new.block
  972.   note output
  973.   fin.entry
  974. }
  975.  
  976. FUNCTION {unpublished}
  977. { output.bibitem
  978.   list.label.output
  979.   ": " list.year * output.nonnull
  980.   author "author" item.check
  981.   title.field field.used =
  982.     { skip$ }
  983.     { format.title "title" output.check }
  984.   if$
  985.   note "note" output.check
  986.   fin.entry
  987. }
  988.  
  989. FUNCTION {default.type} { misc }
  990.  
  991. MACRO {jan} {"January"}
  992.  
  993. MACRO {feb} {"February"}
  994.  
  995. MACRO {mar} {"March"}
  996.  
  997. MACRO {apr} {"April"}
  998.  
  999. MACRO {may} {"May"}
  1000.  
  1001. MACRO {jun} {"June"}
  1002.  
  1003. MACRO {jul} {"July"}
  1004.  
  1005. MACRO {aug} {"August"}
  1006.  
  1007. MACRO {sep} {"September"}
  1008.  
  1009. MACRO {oct} {"October"}
  1010.  
  1011. MACRO {nov} {"November"}
  1012.  
  1013. MACRO {dec} {"December"}
  1014.  
  1015. MACRO {acmcs} {"ACM Computing Surveys"}
  1016.  
  1017. MACRO {acta} {"Acta Informatica"}
  1018.  
  1019. MACRO {cacm} {"Communications of the ACM"}
  1020.  
  1021. MACRO {ibmjrd} {"IBM Journal of Research and Development"}
  1022.  
  1023. MACRO {ibmsj} {"IBM Systems Journal"}
  1024.  
  1025. MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
  1026.  
  1027. MACRO {ieeetc} {"IEEE Transactions on Computers"}
  1028.  
  1029. MACRO {ieeetcad}
  1030.  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
  1031.  
  1032. MACRO {ipl} {"Information Processing Letters"}
  1033.  
  1034. MACRO {jacm} {"Journal of the ACM"}
  1035.  
  1036. MACRO {jcss} {"Journal of Computer and System Sciences"}
  1037.  
  1038. MACRO {scp} {"Science of Computer Programming"}
  1039.  
  1040. MACRO {sicomp} {"SIAM Journal on Computing"}
  1041.  
  1042. MACRO {tocs} {"ACM Transactions on Computer Systems"}
  1043.  
  1044. MACRO {tods} {"ACM Transactions on Database Systems"}
  1045.  
  1046. MACRO {tog} {"ACM Transactions on Graphics"}
  1047.  
  1048. MACRO {toms} {"ACM Transactions on Mathematical Software"}
  1049.  
  1050. MACRO {toois} {"ACM Transactions on Office Information Systems"}
  1051.  
  1052. MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
  1053.  
  1054. MACRO {tcs} {"Theoretical Computer Science"}
  1055.  
  1056. READ
  1057.  
  1058. EXECUTE {init.field.constants}
  1059.  
  1060. FUNCTION {sortify}
  1061. { purify$
  1062.   "l" change.case$
  1063. }
  1064.  
  1065. FUNCTION {sortify.names}
  1066. { " and " " " replace.substring
  1067.   " et~al." " zzz" replace.substring
  1068.   sortify
  1069. }
  1070.  
  1071. FUNCTION {author.key.label}
  1072. { author empty$
  1073.     { key empty$
  1074.     { title.field 'field.used := }
  1075.     { key.field 'field.used := }
  1076.       if$
  1077.     }
  1078.     { author.field 'field.used := }
  1079.   if$
  1080. }
  1081.  
  1082. FUNCTION {author.editor.key.label}
  1083. { author empty$
  1084.     { editor empty$
  1085.     { key empty$
  1086.         { title.field 'field.used := }
  1087.         { key.field 'field.used := }
  1088.       if$
  1089.       }
  1090.     { editor.field 'field.used := }
  1091.       if$
  1092.     }
  1093.     { author.field 'field.used := }
  1094.   if$
  1095. }
  1096.  
  1097. FUNCTION {author.key.organization.label}
  1098. { author empty$
  1099.     { key empty$
  1100.     { organization empty$
  1101.         { title.field 'field.used := }
  1102.         { organization.field 'field.used := }
  1103.       if$
  1104.     }
  1105.     { key.field 'field.used := }
  1106.       if$
  1107.     }
  1108.     { author.field 'field.used := }
  1109.   if$
  1110. }
  1111.  
  1112. FUNCTION {editor.key.organization.label}
  1113. { editor empty$
  1114.     { key empty$
  1115.     { organization empty$
  1116.         { title.field 'field.used := }
  1117.         { organization.field 'field.used := }
  1118.       if$
  1119.     }
  1120.     { key.field 'field.used := }
  1121.       if$
  1122.     }
  1123.     { editor.field 'field.used := }
  1124.   if$
  1125. }
  1126.  
  1127. FUNCTION {sort.format.title}
  1128. { 't :=
  1129.   "A " #2
  1130.     "An " #3
  1131.       "The " #4 t chop.word
  1132.     chop.word
  1133.   chop.word
  1134.   sortify
  1135.   #1 global.max$ substring$
  1136. }
  1137.  
  1138. FUNCTION {calc.label}
  1139. { make.abbr.label
  1140.   title.field field.used =
  1141.     { sort.format.title }
  1142.     { sortify.names }
  1143.   if$
  1144.   year field.or.null purify$ #-1 #4 substring$ sortify
  1145.   *
  1146.   'sort.label :=
  1147. }
  1148.  
  1149. FUNCTION {preliminaries} %%%XXX change
  1150. { type$ "book" =
  1151.   type$ "inbook" =
  1152.   or
  1153.     'author.editor.key.label
  1154.     { type$ "proceedings" =
  1155.     'editor.key.organization.label
  1156.     { type$ "manual" =
  1157.         'author.key.organization.label
  1158.         'author.key.label
  1159.       if$
  1160.     }
  1161.       if$
  1162.     }
  1163.   if$
  1164.   author.field field.used = %%%XXX change
  1165.     {
  1166.       author num.names$ #2 >
  1167.         { #1 }
  1168.         { #0 }
  1169.       if$
  1170.       'etal.required :=
  1171.     }
  1172.     {
  1173.       editor.field field.used = 
  1174.         {
  1175.           editor num.names$ #2 >
  1176.             { #1 }
  1177.             { #0 }
  1178.           if$
  1179.         }
  1180.         { #0 }
  1181.       if$
  1182.       'etal.required :=
  1183.     }
  1184.   if$
  1185.   #1 'etal.allowed :=
  1186. }
  1187.  
  1188. FUNCTION {first.presort}
  1189. { calc.label
  1190.   sort.label
  1191.   title.field field.used =
  1192.     { skip$ }
  1193.     { "    "
  1194.       *
  1195.       make.list.label sortify.names
  1196.       *
  1197.       "    "
  1198.       *
  1199.       title field.or.null
  1200.       sort.format.title
  1201.       *
  1202.     }
  1203.   if$
  1204.   #1 entry.max$ substring$
  1205.   'sort.key$ :=
  1206. }
  1207.  
  1208. ITERATE {preliminaries}
  1209.  
  1210. ITERATE {first.presort}
  1211.  
  1212. SORT
  1213.  
  1214. STRINGS { last.sort.label next.extra last.full.label }
  1215.  
  1216. INTEGERS { last.extra.num last.etal.allowed }
  1217.  
  1218. FUNCTION {initialize.confusion}
  1219. { #0 int.to.chr$ 'last.sort.label :=
  1220.   #0 int.to.chr$ 'last.full.label :=
  1221.   #1 'last.etal.allowed :=
  1222. }
  1223.  
  1224. FUNCTION {confusion.pass}
  1225. { last.sort.label sort.label =
  1226.     { last.etal.allowed 
  1227.         { last.full.label make.full.label sortify.names =
  1228.             { skip$ }
  1229.             { #0 'etal.allowed :=
  1230.               #0 'last.etal.allowed :=
  1231.             }
  1232.           if$
  1233.         }
  1234.         { #0 'etal.allowed := }
  1235.       if$
  1236.     }
  1237.     { sort.label 'last.sort.label :=
  1238.       make.full.label sortify.names 'last.full.label :=
  1239.       #1 'last.etal.allowed :=
  1240.     }
  1241.   if$
  1242. }
  1243.  
  1244. EXECUTE {initialize.confusion}
  1245.  
  1246. ITERATE {confusion.pass}
  1247.  
  1248. EXECUTE {initialize.confusion}
  1249.  
  1250. REVERSE {confusion.pass}
  1251.  
  1252. FUNCTION {initialize.last.extra.num}
  1253. { #0 int.to.chr$ 'last.sort.label :=
  1254.   "" 'next.extra :=
  1255.   #0 'last.extra.num :=
  1256. }
  1257.  
  1258. FUNCTION {forward.pass}
  1259. { last.sort.label sort.label =
  1260.     { last.extra.num #1 + 'last.extra.num :=
  1261.       last.extra.num int.to.chr$ 'extra.label :=
  1262.     }
  1263.     { "a" chr.to.int$ 'last.extra.num :=
  1264.       "" 'extra.label :=
  1265.       sort.label 'last.sort.label :=
  1266.     }
  1267.   if$
  1268. }
  1269.  
  1270. FUNCTION {reverse.pass}
  1271. { next.extra "b" =
  1272.     { "a" 'extra.label := }
  1273.     'skip$
  1274.   if$
  1275.   year empty$
  1276.     { "n.d." extra.label * 'list.year := }
  1277.     { year extra.label * 'list.year := }
  1278.   if$
  1279.   extra.label 'next.extra :=
  1280. }
  1281.  
  1282. ITERATE {first.presort}
  1283.  
  1284. SORT
  1285.  
  1286. EXECUTE {initialize.last.extra.num}
  1287.  
  1288. ITERATE {forward.pass}
  1289.  
  1290. REVERSE {reverse.pass}
  1291.  
  1292. FUNCTION {second.presort}
  1293. { make.list.label
  1294.   title.field field.used =
  1295.     { sort.format.title }
  1296.     { sortify.names }
  1297.   if$
  1298.   "    "
  1299.   *
  1300.   list.year field.or.null sortify
  1301.   *
  1302.   "    "
  1303.   *
  1304.   title.field field.used =
  1305.     { skip$ }
  1306.     { title field.or.null
  1307.       sort.format.title
  1308.       *
  1309.     }
  1310.   if$
  1311.   #1 entry.max$ substring$
  1312.   'sort.key$ :=
  1313. }
  1314.  
  1315. ITERATE {second.presort}
  1316.  
  1317. SORT
  1318.  
  1319. FUNCTION {begin.bib}
  1320. { preamble$ empty$
  1321.     'skip$
  1322.     { preamble$ write$ newline$ }
  1323.   if$
  1324.   "\begin{thebibliography}{xx}" write$ newline$
  1325. }
  1326.  
  1327. EXECUTE {begin.bib}
  1328.  
  1329. EXECUTE {init.state.consts}
  1330.  
  1331. ITERATE {call.type$}
  1332.  
  1333. FUNCTION {end.bib}
  1334. { newline$
  1335.   "\end{thebibliography}" write$ newline$
  1336. }
  1337.  
  1338. EXECUTE {end.bib}
  1339.